<?php 
	session_start();
	$agent = strtolower($_SERVER["HTTP_USER_AGENT"]);
	if(!strstr($agent, "firefox") && !strstr($agent, "msie")) {
		// Mostra seu conteudo 
	} else {
		// Erro navegador FireFox ou IE bloquedao ...
		header('location:bloqueia_firefoxie.php');
	}
?>

<script language='JavaScript' charset="utf-8">
function limpaForm(){
	document.form1.data_idas.value = "";
	document.form1.hora_partida = "";
	document.form1.data_volta.value = "";
	document.form1.hora_chegada = "";
}

function valida() {
	data_ida = document.form1.data_idas.value;
	hora_partida = document.form1.hora_partida.value;
	data_volta = document.form1.data_volta.value;
	hora_chegada = document.form1.hora_chegada.value;

	if(data_ida==0000-00-00){
		alert("Por favor, preencha a data de partida.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(hora_partida==""){
		alert("Por favor, selecione um horário de partida.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(data_volta==0000-00-00){
		alert("Por favor, preencha a data de chegada.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(data_volta < data_ida){
		alert("Atenção, data de volta menor que data de partida.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(hora_chegada==""){
		alert("Por favor, selecione um horário de chegada.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else{
		document.forms['form1'].onsubmit = function(){return true;};
	}
	
}

</script>

<!DOCTYPE html>
<html lang="pt-br">
	<head>
		<meta charset="utf-8"/>
		<title>SIRI</title>
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<link href="css/style.css" rel="stylesheet">
		<!--<style type="text/css">@import url('css/bootstrap.css');</style>
		<script src="http://code.jquery.com/jquery-latest.min.js"></script>
		<script src="js/bootstrap.js"></script>
		<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
		<script type="text/javascript" src="js/jquery.quick.search.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>-->
		<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
	</head>
	<body>
		<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">
						<span class="glyphicon glyphicon-user"></span> <strong>Disponibilidade de Veículos</strong>
					</h3>
				</div>
				<div class="panel-body">
			<div class="row clearfix">
				<div class="col-md-4 column">
				</div>
				<div class="col-md-4 column">
			<form role="form" method="POST" name="form1" action="controller/controller.php" >
					<input type="hidden" name="acao" value="retornaveiculos">
				<div class="form-group">
					<label>Data de Partida</label><input type="date" class="form-control" name="data_idas">
				</div>
				<div class="form-group">
					<label>Horário de Partida</label>
					<select class="form-control span2" name="hora_partida">
						<option value=""></option>
						<option value="01:00">01:00</option>
						<option value="02:00">02:00</option>
						<option value="03:00">03:00</option>
						<option value="04:00">04:00</option>
						<option value="05:00">05:00</option>
						<option value="06:00">06:00</option>
						<option value="07:00">07:00</option>
						<option value="08:00">08:00</option>
						<option value="09:00">09:00</option>
						<option value="10:00">10:00</option>
						<option value="11:00">11:00</option>
						<option value="12:00">12:00</option>
						<option value="13:00">13:00</option>
						<option value="14:00">14:00</option>
						<option value="15:00">15:00</option>
						<option value="16:00">16:00</option>
						<option value="17:00">17:00</option>
						<option value="18:00">18:00</option>
						<option value="19:00">19:00</option>
						<option value="20:00">20:00</option>
						<option value="21:00">21:00</option>
						<option value="22:00">22:00</option>
						<option value="23:00">23:00</option>
						<option value="24:00">24:00</option>
					</select>
				</div>
				<div class="form-group">
					<label>Data de Chegada</label><input type="date" class="form-control" name="data_volta">
				</div>
				<div class="form-group">
					<label>Horário de Chegada</label>
					<select class="form-control span2" name="hora_chegada">
						<option value=""></option>
						<option value="01:00">01:00</option>
						<option value="02:00">02:00</option>
						<option value="03:00">03:00</option>
						<option value="04:00">04:00</option>
						<option value="05:00">05:00</option>
						<option value="06:00">06:00</option>
						<option value="07:00">07:00</option>
						<option value="08:00">08:00</option>
						<option value="09:00">09:00</option>
						<option value="10:00">10:00</option>
						<option value="11:00">11:00</option>
						<option value="12:00">12:00</option>
						<option value="13:00">13:00</option>
						<option value="14:00">14:00</option>
						<option value="15:00">15:00</option>
						<option value="16:00">16:00</option>
						<option value="17:00">17:00</option>
						<option value="18:00">18:00</option>
						<option value="19:00">19:00</option>
						<option value="20:00">20:00</option>
						<option value="21:00">21:00</option>
						<option value="22:00">22:00</option>
						<option value="23:00">23:00</option>
						<option value="24:00">24:00</option>
					</select>
				</div>
					  <button type="submit" class="btn btn-success" onClick="valida();" >Consultar</button>
					</form>
					<?php 
						if(isset ($_SESSION['info'])){
							$data = $_SESSION['info'];
					?>
					<table class="table table-hover lista-servico" align="center">
					<thead>
						<tr>
							<th>Veículos Disponíveis</th>
						</tr>
					</thead>
					<tbody>
					<?php
							foreach($data as $dados){
								echo '<tr>';
								echo '<td>'.$dados['veiculo'].'</td>';
								echo '</tr>';
								//echo $dados['veiculo'];
							}
							//echo "Tem mais não tem";
							session_destroy(); // DESTRUINDO A SEÇÃO
						}else{
							
						}
					?>
					</tbody>
					</table>
				</div>
				<div class="col-md-4 column">
				</div>
			</div>
			</div>
	<div class="panel-footer">
					<small><p class="text-right text-muted">Desenvolvido pela <a href="http://www.ifsertao-pe.edu.br/dgti" target="_blank" title="Coordenação de Tecnologia da Informação">CTI</a></p></small>
	</div>
	</div>
	</body>
</html>